/*
 ============================================================================
 Name        : networkalgorithms.c
 Author      : Jfhu
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>
#include "heap.h"

int main(void) {

	int ary[10] = {1,2,3,4,5,6,7,8,9,10};
	int min;
	pHeap h = makeheap(ary, 10, 2);

	printfHeap(h);

	/* Test the sift up method */
	h->arr[7] = -2;
	siftup(-2, 7, h);
	printf("After sift up: \n");
	printfHeap(h);

	/* Test the deletedmin method */
	min = deletemin(h);
	printf("After delete minimum: \n");
	printf("Min: %d\n", min);
	printfHeap(h);

	/* Test the sift down method */
	h->arr[0] = 100;
	siftdown(100, 0, h);
	printf("After sift down: \n");
	printfHeap(h);

	destroyHeap(h);

	return EXIT_SUCCESS;
}
